#if !defined(AFX_BASEPANEL_H__0E60D122_0137_43D0_B610_9B34AA6A6B8D__INCLUDED_)
#define AFX_BASEPANEL_H__0E60D122_0137_43D0_B610_9B34AA6A6B8D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BasePanel.h : header file
//

class ColorScheme  
{
public:
  ColorScheme() {ZeroMemory(this, sizeof(ColorScheme));}

  COLORREF GetCaptionColor(int nWidth, int nIndex) const;

  COLORREF m_crCaption;
  COLORREF m_crGradientCaption;
  int m_nActiveLabelBmpId;
  int m_nInactiveLabelBmpId;
};

/////////////////////////////////////////////////////////////////////////////
// CBasePanel window

#define PT_UNKNOWN            0
#define PT_COALMINE           1
#define PT_MONUNIT            2
#define PT_ALARMDATA          3
#define PT_USERDEFINEDDISPLAY 4

class CBaseSurface;
class BaseCoalMineUnit;
class BaseMonitoringUnit;

const int kCaptionHeight = 18;

class CBasePanel : public CWnd
{
// Construction
protected:
	CBasePanel();

// Attributes
protected:
  std::vector<CBaseSurface *> m_Surfaces;
  CBitmapButton m_btnClose;
  CBaseSurface * m_pActiveSurface;
  int m_nPanelType;
  long m_nCoalMineId;
  CString m_strMonUnitId;
  ColorScheme m_ColorScheme;

protected:
  static int m_nGDIResourceCounter;
  static CFont * m_pFont;

// Operations
public:
  virtual bool Create(const CString& strWindowName, CWnd * pParentWnd, const CRect& rect, bool bVisible = true);
  virtual void CreateSurfaces() {}
  virtual void Paint(CDC& dc) = 0;
  virtual long GetCoalMineId() const {return m_nCoalMineId;} 
  virtual const CString& GetMonUnitId() const {return m_strMonUnitId;}
  virtual void UpdateDisplay();
  virtual void UpdateDataDisplay(BaseCoalMineUnit * pCoalMineUnit, BaseMonitoringUnit * pMonitoringUnit);
  virtual void UpdateDefinitionDisplay(BaseCoalMineUnit * pCoalMineUnit);
  virtual void GetMinMaxInfo(MINMAXINFO FAR* lpMMI) = 0;
  virtual void ApplyOptions(DWORD dwOptionPagesMask);

  void AddSurface(CBaseSurface * pSurface);
  void DestroyAllSurfaces();
  void GetCaptionRect(LPRECT lpRect) const;
  void GetSurfaceRect(LPRECT lpRect) const;
  void GetLabelRect(LPRECT lpRect) const;
  void ActivateSurface(CBaseSurface * pSurface);
  void ActivateSurface(int nIndex);
  void ShowSurface(CBaseSurface * pSurface, bool bShow = true);
  CBaseSurface * GetpSurfaceByPoint(const CPoint& point) const;
  int GetPanelType() const {return m_nPanelType;}
  BaseCoalMineUnit * GetCoalMineUnit() const;
  void GetCoalMineUnitAndMonUnit(BaseCoalMineUnit *& pCoalMineUnit, BaseMonitoringUnit *& pMonitoringUnit) const;
  const ColorScheme& GetColorScheme() const {return m_ColorScheme;}
  static CFont * GetpFont() {return m_pFont;}

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CBasePanel)
	protected:
	virtual void PostNcDestroy();
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CBasePanel();

	// Generated message map functions
protected:
	//{{AFX_MSG(CBasePanel)
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnDestroy();
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	//}}AFX_MSG
  afx_msg void OnPanelClose();
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BASEPANEL_H__0E60D122_0137_43D0_B610_9B34AA6A6B8D__INCLUDED_)
